Skip to main content

GetText

Returns the inner text of the current document content object.

Syntax

expression.GetText(oProps, oProps.NewLine, oProps.NewLineParagraph, oProps.Numbering, oProps.Math, oProps.TableCellSeparator, oProps.TableRowSeparator, oProps.ParaSeparator, oProps.TabSymbol, oProps.NewLineSeparator);

expression - A variable that represents a ApiDocument class.

Parameters

NameRequired/OptionalData typeDefaultDescription
oPropsRequiredobjectThe resulting string display properties.
oProps.NewLineRequiredbooleanDefines if the resulting string will include line boundaries or not (they will be replaced with '\r').
oProps.NewLineParagraphRequiredbooleanDefines if the resulting string will include paragraph line boundaries or not.
oProps.NumberingRequiredbooleanDefines if the resulting string will include numbering or not.
oProps.MathRequiredbooleanDefines if the resulting string will include mathematical expressions or not.
oProps.TableCellSeparatorRequiredstringDefines how the table cell separator will be specified in the resulting string.
oProps.TableRowSeparatorRequiredstringDefines how the table row separator will be specified in the resulting string.
oProps.ParaSeparatorRequiredstringDefines how the paragraph separator will be specified in the resulting string.
oProps.TabSymbolRequiredstringDefines how the tab will be specified in the resulting string.
oProps.NewLineSeparatorRequiredstringDefines how the line separator will be specified in the resulting string (this property has the priority over NewLine).

Returns

string

Example

This example gets a text from document content element.

let oDocument = Api.GetDocument();
let oBlockLvlSdt = Api.CreateBlockLvlSdt();
oDocument.Push(oBlockLvlSdt);
let oContent = oBlockLvlSdt.GetContent();
oContent.GetElement(0).AddText("This is a block text content control.");
let oPara = Api.CreateParagraph();
oPara.AddText("This text from DocContent element: " + oContent.GetText());
oDocument.Push(oPara);